import { formatTime } from '@/utils'
import i18n from '@/locales/index' 
const { t } = i18n.global
let env = process.env.VUE_APP_CONFIG
export const listColumns = [
  {
    title18: 'common.sequenceNo', dataIndex: 'index', key: 'index', align: 'center', width: 60, fixed: 'left',
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title18: 'hangManage.makeNo', dataIndex: 'moNo', key: 'moNo', width: 120, align: 'center', fixed: 'left', sorter: true, resizable: true, },
  { title18: 'basicData.styleNo', dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 120, sorter: true, resizable: true },
  { title18: 'basicData.styleNa', dataIndex: 'style', key: 'style', align: 'center', width: 120, sorter: true, resizable: true, visibility: false },
  { title18: 'hangManage.workOrderNo', dataIndex: 'workOrderNo', key: 'workOrderNo', align: 'center', width: 120, sorter: true, resizable: true, visibility: false },
  { title18: 'basicData.productType', dataIndex: 'productType', key: 'productType', align: 'center', width: 120, sorter: true, resizable: true, visibility: false },
  { title18: 'basicData.orderNo', dataIndex: 'orderNo', key: 'orderNo', align: 'center', width: 120, sorter: true, resizable: true, visibility: false },
  { title18: 'basicData.customerName', dataIndex: 'custom', key: 'custom', align: 'center', width: 120, sorter: true, resizable: true, visibility: false },
  { title18: 'basicData.totalPiece', dataIndex: 'quantity', key: 'quantity', align: 'right', width: 120, sorter: true, resizable: true },
  { title18: 'hangManage.scheduled', dataIndex: 'alreadyBillQty', key: 'alreadyBillQty', align: 'right', width: 120, resizable: true },
  { title18: 'hangManage.producted', dataIndex: 'alreadyProductQty', key: 'alreadyProductQty', align: 'right', width: 120, resizable: true },
  { title18: 'hangManage.completeRate', dataIndex: 'percentage', key: 'percentage', align: 'right', width: 120, resizable: true },
  {
    title18: 'basicData.PayDate', dataIndex: 'deliveryDate', key: 'deliveryDate', align: 'center', width: 120, sorter: true, timeType: 'day', resizable: true, visibility: false,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD')
    },
  },
  {
    title18: 'hangManage.preProductTime', dataIndex: 'productDate', key: 'productDate', align: 'center', width: 150, sorter: true, timeType: 'day', resizable: true, visibility: false,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD')
    },
  },
  {
    title18: 'hangManage.makeCreateTime', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, sorter: true, timeType: 'time', resizable: true,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    },
  },
  {
    title18: 'common.lastEditTime', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, sorter: true, timeType: 'time', resizable: true, visibility: false,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    },
  },
  { title18: 'common.founder', dataIndex: 'createBy', key: 'createBy', align: 'center', width: 80 },
  { title18: 'common.state', dataIndex: 'status', key: 'status', align: 'center', width: 80, sorter: true, fixed: 'right', resizable: true },
  { title18: 'common.operate', dataIndex: 'operate', key: 'operate', align: 'center', width: env == 'online' ? 170 : env == 'local' ? 190 : 245, fixed: 'right' }
]
export const syncDataAry = [
  { syncIotCloudDataType: 'ihs:production:manufactureorder' },
  { syncIotCloudDataType: 'ihs:production:style' },
  { syncIotCloudDataType: 'ihs:basic:color' },
  { syncIotCloudDataType: 'ihs:basic:size' },
  { syncIotCloudDataType: 'ihs:basic:productPart' },
  { syncIotCloudDataType: 'ihs:production:order' },
  { syncIotCloudDataType: 'ihs:production:customer' },
  { syncIotCloudDataType: 'ihs:system:attachment' }
]
export const statusList = [
  { value: 0, label: t('other.unProduction') },
  { value: 1, label: t('other.inProduct') },
  { value: 2, label: t('sysManage.completed') }
]
export const operateInfo = [
  [
    { value: 1, label: t('common.editor') },
    { value: 2, label: t('common.del') },
    { value: 3, label: t('other.copy') },
    // { value: 7, label: '远程排产' },
  ],
  [
    { value: 4, label: t('other.markWin') },
    { value: 3, label: t('other.copy') },
  ],
  [
    // { value: 5, label: '标记为生产t('common.state')' },
    { value: 2, label: t('common.del') },
    { value: 3, label: t('other.copy') },
  ]
]

export const operateInfoDev = [
  [
    { value: 1, label: t('common.editor') },
    { value: 2, label: t('common.del') },
    { value: 3, label: t('other.copy') },
    { value: 10, label: t('other.aiSchedules')},
    // { value: 9, label: '{{ $t('common.addNew') }}排产单' }
  ],
  [
    { value: 1, label: t('common.editor') },
    { value: 4, label: t('layout.complete') },
    { value: 3, label: t('other.copy') },
    { value: 10, label: t('other.aiSchedules') },
    // { value: 9, label: '{{ $t('common.addNew') }}排产单' }
  ],
  [
    // { value: 5, label: '标记为生产t('common.state')' },
    { value: 2, label: t('common.del') },
    { value: 3, label: t('other.copy') },
    { value: 10, label: t('other.aiSchedules') },
  ]
]


export const makeListSearchParams = [
  { title: t('hangManage.makeNo'), key: 'moNo', disabled: true, show: true, type: 'input' },
  { title: t('basicData.styleNo'), key: 'styleNo', show: true, type: 'input' },
  { title: t('basicData.styleNa'), key: 'styleName', show: false, type: 'input' },
  { title: t('hangManage.workOrderNo'), key: 'workOrderNo', type: 'input' },
  { title: t('basicData.productType'), key: 'productTypeList', type: 'select' },
  { title: t('basicData.orderNo'), key: 'orderNo', type: 'input' },
  { title: t('basicData.customerName'), key: 'customName', type: 'input' },
  { title: t('basicData.PayDate'), key: 'DeliveryDate', type: 'time' },
  { title: t('hangManage.preProductTime'), key: 'ProductDate', type: 'time' },
  { title: t('common.createTime'), key: 'Time', type: 'time' },
  { title: t('other.editTime'), key: 'UpdateTime', type: 'time' }

]
export const makeListRule = {
  styleId: [
    { required: true, message: t('other.selectStyleNo'), trigger: 'change' }
  ],
  productDate: [
    // { required: true, message: '$t('common.pleaseSelect')t('hangManage.preProductTime')', trigger: 'change' }
  ],
  deliveryDate: [
    // { required: true, message: '$t('common.pleaseSelect')预计交货时间', trigger: 'change' }
  ]
}

export const _baseColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('basicData.color'), dataIndex: 'colorCode', key: 'colorCode', align: 'center' },
  { title: t('basicData.size'), dataIndex: 'sizeCode', key: 'sizeCode', align: 'center' },
  { title: t('hangManage.poNo'), dataIndex: 'poNo', key: 'poNo', align: 'center' },
  { title: t('hangManage.bedNo'), dataIndex: 'cutterNo', key: 'cutterNo', align: 'center' },
  { title: t('hangManage.cut'), dataIndex: 'tailorBill', key: 'tailorBill', align: 'center' },
  { title: t('hangManage.planNumber'), dataIndex: 'quantity', key: 'quantity', align: 'right' },
]
export const operateColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('basicData.color'), dataIndex: 'colorCode', key: 'colorCode', align: 'center' },
  { title: t('basicData.size'), dataIndex: 'sizeCode', key: 'sizeCode', align: 'center' },
  { title: t('hangManage.poNo'), dataIndex: 'poNo', key: 'poNo', align: 'center' },
  { title: t('hangManage.bedNo'), dataIndex: 'cutterNo', key: 'cutterNo', align: 'center' },
  { title: t('hangManage.cut'), dataIndex: 'tailorBill', key: 'tailorBill', align: 'center' },
  { title: t('hangManage.planNumber'), dataIndex: 'quantity', key: 'quantity', align: 'right' },
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center', fixed: 'right' }
]

export const colorColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('basicData.color'), dataIndex: 'color', key: 'color', align: 'center' },
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center' },
]

export const sizeColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('other.dimension'), dataIndex: 'size', key: 'size', align: 'center' },
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center' },
]


export const schColumns = [
  {
    title: '序号', dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: '排产单', dataIndex: 'scheduleNo', key: 'scheduleNo', align: 'center' },
  { title: '颜色', dataIndex: 'color', key: 'color', align: 'center' },
  { title: '尺码', dataIndex: 'size', key: 'size', align: 'center' },
  { title: 'PO号', dataIndex: 'poNo', key: 'poNo', align: 'center' },
  { title: '床号', dataIndex: 'lot', key: 'lot', align: 'center' },
  { title: '裁剪单', dataIndex: 'cutNo', key: 'cutNo', align: 'center' },
  { title: '任务数', dataIndex: 'produceQty', key: 'produceQty', align: 'center' },
  { title: '挂片数', dataIndex: 'inputQty', key: 'inputQty', align: 'center' },
  { title: '已完成数', dataIndex: 'finishQty', key: 'finishQty', align: 'center' },
  { title: '未完成数', dataIndex: 'unfinishQty', key: 'unfinishQty', align: 'center' },
]